<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
        background-color: lightpink;
      }
    </style>
  </head>
  <body>
    <script>
      var obj = {
        screenLeft: window.screenLeft,
        screenTop: window.screenTop,

        appinnerWidth: window.innerWidth,
        appinnerHeight: window.innerHeight
      };

      function get() {
        obj = {
          screenLeft: window.screenLeft,
          screenTop: window.screenTop,

          appinnerWidth: window.innerWidth,
          appinnerHeight: window.innerHeight
        };
      }

      var objDesc = {
        screenLeft: "浏览器距屏幕左侧水平距离",
        screenTop: "浏览器距屏幕上侧竖直距离",
        appinnerWidth: "",
        appinnerHeight: "不含工具栏的高度,但含滚动条"
      };

      for (x in obj) {
        console.log(obj[x], x + ":" + objDesc[x]);
      }
    </script>
  </body>
</html>
